
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>App打包及接口调用 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="chang-jian-wen-ti.html" />
    
    
    <link rel="prev" href="appye-wu-luo-ji-shuo-ming.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    前言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="jie-shao.html">
            
                <a href="jie-shao.html">
            
                    
                    介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="xu-yao-kan-de-kuang-jia-wen-dang.html">
            
                <a href="xu-yao-kan-de-kuang-jia-wen-dang.html">
            
                    
                    需要看的框架文档
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="an-zhuang.html">
            
                <a href="an-zhuang.html">
            
                    
                    安装与调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="kai-fa-huan-jing-yi-lai-mo-kuai-shuo-ming.html">
            
                <a href="kai-fa-huan-jing-yi-lai-mo-kuai-shuo-ming.html">
            
                    
                    开发环境依赖模块说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="xiang-mu-mu-lu-shuo-ming.html">
            
                <a href="xiang-mu-mu-lu-shuo-ming.html">
            
                    
                    项目目录说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="fa-bu-yun-xing.html">
            
                <a href="fa-bu-yun-xing.html">
            
                    
                    发布运行程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="gou-jian-gong-ju-pei-zhi.html">
            
                <a href="gou-jian-gong-ju-pei-zhi.html">
            
                    
                    构建工具配置说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="appji-zhu-kuang-jia-shuo-ming.html">
            
                <a href="appji-zhu-kuang-jia-shuo-ming.html">
            
                    
                    App技术框架说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="apppei-zhi-yi-ji-qi-ta-fang-fa.html">
            
                <a href="apppei-zhi-yi-ji-qi-ta-fang-fa.html">
            
                    
                    App配置以及其他方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="zu-jian-shuo-ming.html">
            
                <a href="zu-jian-shuo-ming.html">
            
                    
                    组件说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="appye-wu-luo-ji-shuo-ming.html">
            
                <a href="appye-wu-luo-ji-shuo-ming.html">
            
                    
                    App业务逻辑说明
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.11" data-path="appda-bao-ji-jie-kou-diao-yong.html">
            
                <a href="appda-bao-ji-jie-kou-diao-yong.html">
            
                    
                    App打包及接口调用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="chang-jian-wen-ti.html">
            
                <a href="chang-jian-wen-ti.html">
            
                    
                    常见问题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="chang-jian-wen-ti/muikuang-jia-yu-fa-wen-ti.html">
            
                <a href="chang-jian-wen-ti/muikuang-jia-yu-fa-wen-ti.html">
            
                    
                    mui框架语法问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="chang-jian-wen-ti/qi-ta-wen-ti.html">
            
                <a href="chang-jian-wen-ti/qi-ta-wen-ti.html">
            
                    
                    其他问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >App打包及接口调用</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="app&#x6253;&#x5305;&#x53CA;&#x539F;&#x751F;js&#x63A5;&#x53E3;&#x8C03;&#x7528;">app&#x6253;&#x5305;&#x53CA;&#x539F;&#x751F;JS&#x63A5;&#x53E3;&#x8C03;&#x7528;</h2>
<ul>
<li><p>app&#x6253;&#x5305;&#x6280;&#x672F;&#x662F;&#x7528;eclipse&#x5DE5;&#x5177;&#x901A;&#x8FC7;manifest.json&#x914D;&#x7F6E;&#x6253;&#x5305;&#x6210;android&#x548C;iOS,&#x5177;&#x4F53;&#x6559;&#x7A0B;&#x53C2;&#x770B;dcloud&#x63D0;&#x4F9B;&#x7684;<a href="http://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/94" target="_blank">&#x6587;&#x6863;</a>&#x3002;</p>
</li>
<li><p>&#x539F;&#x751F;&#x8BBE;&#x5907;&#x7684;&#x63A5;&#x53E3;&#x6559;&#x7A0B;&#x53C2;&#x770B;dcloud&#x63D0;&#x4F9B;&#x7684;<a href="http://www.html5plus.org/doc/h5p.html" target="_blank">&#x6587;&#x6863;</a>&#x3002;</p>
</li>
<li><p>app&#x7684;&#x66F4;&#x65B0;&#xFF0C;dcloud&#x63D0;&#x4F9B;&#x4E09;&#x79CD;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#x3002;&#x76EE;&#x524D;&#x91C7;&#x7528;&#x7B2C;&#x4E00;&#x79CD;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x6848;&#x4F5C;&#x4E3A;&#x5907;&#x7528;&#x3002;</p>
<ul>
<li>&#x6574;&#x5305;(apk/ipa)&#x5347;&#x7EA7; </li>
<li>App&#x8D44;&#x6E90;&#x5728;&#x7EBF;&#x5347;&#x7EA7;&#x66F4;&#x65B0;&#xFF08;&#x751F;&#x6210;&#x79FB;&#x52A8;App&#x8D44;&#x6E90;&#x5347;&#x7EA7;&#x5305;&#x76F4;&#x63A5;&#x4E0B;&#x8F7D;&#x66F4;&#x65B0;&#xFF09;</li>
<li>App&#x8D44;&#x6E90;&#x5728;&#x7EBF;&#x5DEE;&#x91CF;&#x5347;&#x7EA7;&#x66F4;&#x65B0;&#xFF08;&#x5DEE;&#x91CF;&#x5347;&#x7EA7;&#x5305;&#x662F;&#x9488;&#x5BF9;&#x67D0;&#x4E2A;&#x5386;&#x53F2;&#x7248;&#x672C;&#x5230;&#x65B0;&#x7248;&#x672C;&#x7684;&#x5DEE;&#x91CF;&#xFF0C;&#x6240;&#x4EE5;&#x5BF9;&#x4E8E;&#x5347;&#x7EA7;&#x670D;&#x52A1;&#x5668;&#x6765;&#x8BB2;&#x9700;&#x8981;&#x4FDD;&#x7559;&#x6240;&#x6709;&#x5386;&#x53F2;&#x7248;&#x672C;&#xFF0C;&#x5E76;&#x4E14;&#x5206;&#x522B;&#x751F;&#x6210;&#x6BCF;&#x4E2A;&#x5386;&#x53F2;&#x7248;&#x672C;&#x5230;&#x65B0;&#x7248;&#x672C;&#x7684;&#x5DEE;&#x91CF;&#x5347;&#x7EA7;&#x5305;&#x3002;&#xFF09;
&#x5176;&#x66F4;&#x65B0;&#x7684;JS&#x7684;&#x4EE3;&#x7801;&#x5982;&#x4E0B;</li>
</ul>
</li>
</ul>
<pre><code>// src/mine/update.js
    //&#x8D44;&#x6E90;&#x5728;&#x7EBF;&#x5347;&#x7EA7;&#x66F4;&#x65B0;
    updateWgt(){
        plus.downloader.createDownload(&quot;http://demo.dcloud.net.cn/test/update/H5EF3C469.wgt&quot;, {filename:&quot;_doc/update/&quot;}, function(d,status){
            plus.nativeUI.showWaiting(&quot;&#x4E0B;&#x8F7D;wgt&#x6587;&#x4EF6;...&quot;);
            if ( status == 200 ) { 
                app.log.debug(&quot;&#x4E0B;&#x8F7D;wgt&#x6210;&#x529F;&#xFF1A;&quot;+ d.filename);
                plus.nativeUI.showWaiting(&quot;&#x5B89;&#x88C5;wgt&#x6587;&#x4EF6;...&quot;);
                plus.runtime.install(d.filename, {} ,function(){
                    plus.nativeUI.closeWaiting();
                    app.log.debug(&quot;&#x5B89;&#x88C5;wgt&#x6587;&#x4EF6;&#x6210;&#x529F;&#xFF01;&quot;);
                    plus.nativeUI.alert(&quot;&#x5E94;&#x7528;&#x8D44;&#x6E90;&#x66F4;&#x65B0;&#x5B8C;&#x6210;&#xFF01;&quot;,function(){
                        plus.runtime.restart();
                    });
                },function(e){
                    plus.nativeUI.closeWaiting();
                    app.log.debug(&quot;&#x5B89;&#x88C5;wgt&#x6587;&#x4EF6;&#x5931;&#x8D25;[&quot;+e.code+&quot;]&#xFF1A;&quot;+e.message);
                    plus.nativeUI.alert(&quot;&#x5B89;&#x88C5;wgt&#x6587;&#x4EF6;&#x5931;&#x8D25;[&quot;+e.code+&quot;]&#xFF1A;&quot;+e.message);
                });
            } else {
                app.log.debug(&quot;&#x4E0B;&#x8F7D;wgt&#x5931;&#x8D25;&#xFF01;&quot;);
                plus.nativeUI.alert(&quot;&#x4E0B;&#x8F7D;wgt&#x5931;&#x8D25;&#xFF01;&quot;);
            }
            plus.nativeUI.closeWaiting();
        }).start();
    },
    //&#x6574;&#x5305;&#x66F4;&#x65B0;
    updateApk(){
        if(app.Config.device.isAndroid){
            plus.downloader.createDownload(&quot;&quot;, {filename:&quot;_doc/update/&quot;}, function(d,status){
                plus.nativeUI.showWaiting(&quot;&#x4E0B;&#x8F7D;app&#x6587;&#x4EF6;...&quot;);
                if ( status == 200 ) { 
                    app.log.debug(&quot;&#x4E0B;&#x8F7D;app&#x6210;&#x529F;&#xFF1A;&quot;+ d.filename);
                    plus.nativeUI.showWaiting(&quot;&#x5B89;&#x88C5;app&#x6587;&#x4EF6;...&quot;);
                    plus.runtime.install(d.filename, {} ,function(){
                        plus.nativeUI.closeWaiting();
                        app.log.debug(&quot;&#x5B89;&#x88C5;app&#x6587;&#x4EF6;&#x6210;&#x529F;&#xFF01;&quot;);
                        plus.nativeUI.alert(&quot;&#x5E94;&#x7528;&#x8D44;&#x6E90;&#x66F4;&#x65B0;&#x5B8C;&#x6210;&#xFF01;&quot;,function(){
                            plus.runtime.restart();
                        });
                    },function(e){
                        plus.nativeUI.closeWaiting();
                        app.log.debug(&quot;&#x5B89;&#x88C5;app&#x6587;&#x4EF6;&#x5931;&#x8D25;[&quot;+e.code+&quot;]&#xFF1A;&quot;+e.message);
                        plus.nativeUI.alert(&quot;&#x5B89;&#x88C5;app&#x6587;&#x4EF6;&#x5931;&#x8D25;[&quot;+e.code+&quot;]&#xFF1A;&quot;+e.message);
                    });
                } else {
                    app.log.debug(&quot;&#x4E0B;&#x8F7D;wgt&#x5931;&#x8D25;&#xFF01;&quot;);
                    plus.nativeUI.alert(&quot;&#x4E0B;&#x8F7D;wgt&#x5931;&#x8D25;&#xFF01;&quot;);
                }
                plus.nativeUI.closeWaiting();
            }).start();
        } else if(app.Config.device.isIOS){
            //iOS&#x5E73;&#x53F0;&#x7684;ipa&#x65E0;&#x6CD5;&#x5B89;&#x88C5;&#xFF0C;&#x6B64;&#x65F6;&#x9700;&#x8981;&#x8DF3;&#x8F6C;&#x5230;appstore&#xFF0C;&#x63D0;&#x793A;&#x7528;&#x6237;&#x81EA;&#x52A8;&#x70B9;&#x51FB;&#x5347;&#x7EA7;&#x66F4;&#x65B0;&#xFF0C;&#x8DF3;&#x8F6C;&#x5230;appstore&#x7684;&#x65B9;&#x6CD5;&#x4E3A;&#x6253;&#x5F00;&#x5E94;&#x7528;&#x7684;appstore&#x5730;&#x5740;
            var url=&apos;itms-apps://itunes.apple.com/cn/app/hello-h5+/id682211190?l=zh&amp;mt=8&apos;;// HelloH5&#x5E94;&#x7528;&#x5728;appstore&#x7684;&#x5730;&#x5740;
            plus.runtime.openURL(url);
        }
    }
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="appye-wu-luo-ji-shuo-ming.html" class="navigation navigation-prev " aria-label="Previous page: App业务逻辑说明">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="chang-jian-wen-ti.html" class="navigation navigation-next " aria-label="Next page: 常见问题">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"App打包及接口调用","level":"1.11","depth":1,"next":{"title":"常见问题","level":"1.12","depth":1,"path":"chang-jian-wen-ti.md","ref":"chang-jian-wen-ti.md","articles":[{"title":"mui框架语法问题","level":"1.12.1","depth":2,"path":"chang-jian-wen-ti/muikuang-jia-yu-fa-wen-ti.md","ref":"chang-jian-wen-ti/muikuang-jia-yu-fa-wen-ti.md","articles":[]},{"title":"其他问题","level":"1.12.2","depth":2,"path":"chang-jian-wen-ti/qi-ta-wen-ti.md","ref":"chang-jian-wen-ti/qi-ta-wen-ti.md","articles":[]}]},"previous":{"title":"App业务逻辑说明","level":"1.10","depth":1,"path":"appye-wu-luo-ji-shuo-ming.md","ref":"appye-wu-luo-ji-shuo-ming.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"appda-bao-ji-jie-kou-diao-yong.md","mtime":"2017-11-09T21:18:38.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-11-11T03:51:05.960Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

